<% set date british temporaryfolder=addbs(oprop.appstartpath)+[temp\] *temporaryfolder=[temp\] fromdate=orequest.form('datefrom') todate=orequest.form('dateto') if isnull(fromdate) fromdate=NVL(orequest.querystring('datefrom'),'') endif if isnull(todate) todate=NVL(orequest.querystring('dateto'),'') endif theaccode=orequest.form('txtcustomer') if isnull(theaccode) theaccode=orequest.querystring('ac') endif theaccode=transform(theaccode) set date ymd pdate1=ctod(fromdate) pdate2=ctod(todate) set date british usesafe('acctran') usesafe('accounts') locate for accountid=theaccode Acname=allt(accountid)+[ ]+allt(name) if not empty(address1) acname=acname+[
]+allt(address1) endif if not empty(address2) acname=acname+[
]+allt(address2) endif if not empty(phone) acname=acname+[
Contact: ]+allt(phone) endif openingbalancealias=sys(2015) closingbalancealias=sys(2015) SELECT [acctran] SET ORDER TO acdate =seek(theaccode) FILEstring=[

ACCOUNT LEDGER

]+CHR(13) FILESTRING=FILESTRING+ACNAME do case case empty(pdate1) and empty(PDATE2) FILEstring=FILESTRING+[

FROM START TO END

] case not empty(pdate1) and empty(pdate2) FILEstring=FILESTRING+[

FROM ]+transform(pdate1)+[ TO END

] otherwise FILEstring=FILESTRING+[

FROM ]+transform(pdate1)+[ TO ]+transform(pdate2)+[

] ENDCASE STORE 0 TO gldebits, glcredits filestring=FILESTRING+CHR(13)+[] filestring=FILESTRING+[] store 0 to openingbalance, thedebits, thecredits, closingbalance do while not eof() and accountid=theaccode and date0 thedebits=openingbalance ELSE thecredits=abs(openingbalance) ENDIF glhead=glhead+[] glhead=glhead+[ ] glhead=glhead+[ ] glhead=glhead+[ ] glhead=glhead+[] glhead=glhead+[] glhead=glhead+[] filestring=filestring+glhead+CHR(13) glhead="" endif DO WHILE NOT EOF() and accountid=theaccode if not empty(pdate2) and date>pdate2 exit endif glhead=[] if debit-credit>0 thedebits=thedebits+debit-credit endif if credit-DEBIT>0 thecredits=thecredits+credit-debit endif if not empty(debit-credit) closingbalance=closingbalance+debit-credit glhead=glhead+[] glhead=glhead+[ ] glhead=glhead+[ ] glhead=glhead+[ ] glhead=glhead+[] glhead=glhead+[] glhead=glhead+[] endif if not empty(glhead) filestring=filestring+glhead+CHR(13) endif skip ENDDO OVERALL=THEDEBITS-thecredits if not empty(THEDEBITS) OR NOT EMPTY(THECREDITS) glhead="" glhead=glhead+[] glhead=glhead+[] glhead=glhead+[] glhead=glhead+[] filestring=filestring+glhead+chr(13) endif filestring=filestring+CHR(13)+[
DATEVTPTR#DETAILSDEBITCREDITBALANCE
]+transform(pdate1)+[]+allt(transform([OPEN]))+[ OPENING BALANCE]+iif(openingbalance>0,TRANSFORM(openingbalance,'999,999,999,999.99'),[ ])+[]+iif(openingbalance<0,TRANSFORM(abs(openingbalance),'999,999,999,999.99'),[ ])+[]+TRANSFORM(closingbalance,'999,999,999,999.99')+[
]+transform(date)+[]+allt(transform(vtype))+[]+allt(transform(transid))+[]+allt(transform(desc))+[]+iif(debit-credit>0,TRANSFORM(debit-credit,'999,999,999,999.99'),[ ])+[]+iif(credit-debit>0,TRANSFORM(credit-debit,'999,999,999,999.99'),[ ])+[]+TRANSFORM(closingbalance,'999,999,999,999.99')+[
BALANCE:]+iif(THEDEBITS>0,TRANSFORM(THEDEBITS,'999,999,999,999.99'),[ ])+[]+iif(thecredits>0,TRANSFORM(thecredits,'999,999,999,999.99'),[ ])+[]+TRANSFORM(OVERALL,'999,999,999,999.99')+[
] %> SSSoft™ - <%=XCOMPANY.NAME%> Receipt
Creditor
<%=filestring%>